import 'package:flutter/material.dart';
import '../utils/app_icons.dart';

class BottomNavBar extends StatelessWidget {
  final int currentIndex;
  final Function(int) onTap;

  const BottomNavBar({
    Key? key,
    required this.currentIndex,
    required this.onTap,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return BottomNavigationBar(
      currentIndex: currentIndex,
      onTap: onTap,
      type: BottomNavigationBarType.fixed,
      selectedItemColor: Colors.blue,
      unselectedItemColor: Colors.grey,
      items: [
        _buildNavItem('首页', AppIcons.home, 0),
        _buildNavItem('视频', AppIcons.video, 1),
        _buildNavItem('领养', AppIcons.pet, 2),
        _buildNavItem('社区', AppIcons.community, 3),
        _buildNavItem('我的', AppIcons.user, 4),
      ],
    );
  }

  BottomNavigationBarItem _buildNavItem(String label, String iconPath, int index) {
    return BottomNavigationBarItem(
      icon: Image.asset(
        iconPath,
        width: 24,
        height: 24,
        color: currentIndex == index ? Colors.blue : Colors.grey,
      ),
      label: label,
    );
  }
} 